import request from '@/utils/request'

// 获取用户列表
export const getUserList = (params) => {
  return request({
    url: '/users',
    params
  })
}

// 更改用户状态
export const putUserStatus = (id, bool) => {
  return request({
    url: `/users/${id}/state/${bool}`,
    method: 'PUT'
  })
}

// 添加用户
export const addUser = (data) => {
  return request({
    url: '/users',
    method: 'post',
    data
  })
}

// 删除用户
export const delUser = (id) => {
  return request({
    url: `/users/${id}`,
    method: 'delete'
  })
}

// 修改用户
export const editUser = (data) => {
  return request({
    url: `/users/${data.id}`,
    method: 'put',
    data
  })
}
